<?php
/**
 * RequirementDerivation entity
 */
namespace BWL\webshopBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity(repositoryClass="BWL\webshopBundle\Repository\RequirementDerivationRepository")
 * @ORM\Table(name="requirement_derivation")
 * @ORM\HasLifecycleCallbacks()
 */
class RequirementDerivation
{
  /**
   * @ORM\Id
   * @ORM\ManyToOne(targetEntity="Requirement", inversedBy="requirement_derivations")
   * @ORM\JoinColumn(name="requirement_id", referencedColumnName="id", nullable=false)
   */
  protected $requirement;

  /**
   * @ORM\Id
   * @ORM\ManyToOne(targetEntity="Assignment", inversedBy="requirement_derivations")
   * @ORM\JoinColumn(name="assignment_id", referencedColumnName="id", nullable=false)
   */
  protected $assignment;

  /**
   * @ORM\ManyToOne(targetEntity="Item", inversedBy="requirement_derivations")
   * @ORM\JoinColumn(name="parent_item_id", referencedColumnName="id", nullable=false)
   */
  protected $parent_item;

  /**
   * @ORM\Column(type="datetime")
   */
  protected $parent_item_date;

  /**
   * @ORM\Column(type="datetime")
   */
  protected $created;

  /**
   * @ORM\Column(type="datetime")
   */
  protected $updated;

  /**
   * Constructor
   * Sets default values
   */
  public function __construct() {
    $this->setCreated(new \DateTime());
    $this->setUpdated(new \DateTime());
  }

  /**
   * @ORM\PreUpdate
   */
  public function setUpdatedValue() {
    $this->setUpdated(new \DateTime());
  }

  public function getAssignment() {
    return $this->assignment;
  }

  public function getCreated() {
    return $this->created;
  }

  public function getParentItem() {
    return $this->parent_item;
  }

  public function getParentItemDate() {
    return $this->parent_item_date;
  }

  public function getRequirement() {
    return $this->requirement;
  }

  public function getUpdated() {
    return $this->updated;
  }

  public function setAssignment($assignment) {
    $this->assignment = $assignment;
    return $this;
  }

  public function setCreated($created) {
    $this->created = $created;
    return $this;
  }

  public function setParentItem($parent_item) {
    $this->parent_item = $parent_item;
    return $this;
  }

  public function setParentItemDate($parent_item_date) {
    $this->parent_item_date = $parent_item_date;
    return $this;
  }

  public function setRequirement($requirement) {
    $this->requirement = $requirement;
    return $this;
  }

  public function setUpdated($updated) {
    $this->updated = $updated;
    return $this;
  }
}